<template>
    <div>
        <h3>图片游览</h3>
        <ul class="photo-list">
            <!-- tag 属性是指定渲染成li标签 -->
            <router-link v-for="item in list" :key="item.id" :to="'/home/photoinfo/'+ item.id" tag="li">
                <img v-lazy="item.img_url">

                <div class="info">
                    <h1 class="title">{{item.title}}</h1>
                    <div class="body">{{item.zhaiyao}}</div>
                </div>
            </router-link>
        </ul>
    </div>
</template>

<script>
import {photoList} from './../../comment/data/taskDetail'


export default {
    data(){
        return {
            list:[]
        }
    },

    created(){
        this.getPhotoList();
    },

    methods: {
        getPhotoList(){
            this.list = photoList;
        }
    }
    
}
</script>


<style lang="scss" scoped>

.photo-list {
    list-style: none;
    margin: 0px;
    padding: 10px;
    padding-bottom: 0px;
    li {
        background-color: white;
        text-align: center;
        margin-bottom: 10px; 

        position: relative;
        img{
            width: 100%;
            vertical-align: middle;
        }
        img[lazy=loading] {
            width: 40px;
            height: 300px;
            margin: auto;
        }

        .info{
            color: white;
            text-align: left;
            position: absolute;
            bottom: 0px;
            background-color: rgba(0, 0, 0, 0.4);
            width: 100%;
            .title{
                font-size: 13px;
            }
            .body{
                font-size: 12px;
            }
        }
    }
}
</style>